import request from "@/request/request";

// 获取单个采购订单(包含详情)
 export function getPurchaseWithDetails(id) {
    return request({
        method: "get",
        url: `/purchase/withDetails/${id}`,
    })
}

// 创建采购订单
 export function createPurchase(purchaseOrder) {
    return request({
        method: "post",
        url: "/purchase",
        data: purchaseOrder
    })
}

// 查询供应商
export function getSupplier() {
    return request({
        method: "get",
        url: "/purchase/supplier",
    })
}

// 更新采购订单
 export function updatePurchase(purchaseOrder) {
    return request({
        method: "put",
        url: "/purchase",
        data: purchaseOrder
    })
}

// 删除采购订单
 export function deletePurchase(id) {
    return request({
        method: "delete",
        url: `/purchase/${id}`,
    })
}

// 添加分页查询采购订单的方法
export function getPurchasePage(pageParams) {
    return request({
        url: '/purchase/page',
        method: 'post',
        data: pageParams
    })
}
